<ui:composition template="/WEB-INF/templates/login-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:param name="pageName" value="Assign Asset to Employee" />
	
	<ui:define name="menu"></ui:define>
	<ui:define name="submenu"></ui:define>
	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">	
		
		<h:outputText value="Assign Asset(s)" styleClass="outputTextTitle"/>	
		<h:form id="assetForm"> 
		 <p:growl/>
		  <p:growl id="growl"/>
		 
		 <p:panel header="Asset Details"> 
		   <h:panelGrid>
             <p:scrollPanel style="width:900px;height:500px" mode="native"> 
	             <p:dataTable id="assetDetails" selection="#{assetAssignedBySysAdminBean.selectedAsset}" rowKey="#{asset.assetCode}" paginator="true" rows="20" value="#{assetAssignedBySysAdminBean.allAssetsList}" var="asset" >  
	           
		            <p:column> 
		                <f:facet name="header">  
		            		<h:outputText value="S.No" />  
		       		    </f:facet> 
		                <h:outputText value="#{asset.sno}" />
		            </p:column>  
		            
		            <p:column selectionMode="single" headerText="Select"  />  	 
		            
		            <p:column filterMatchMode="contains" filterBy="#{asset.assetCode}"  >
		            	<f:facet name="header">  
		            		<h:outputText value="Asset Code" />  
		       		    </f:facet>  
		                <h:outputText value="#{asset.assetCode}" />
		            </p:column> 
		            
		            <p:column filterMatchMode="contains" filterBy="#{asset.assetName}">
		            	<f:facet name="header">  
		            		<h:outputText value="Asset Name" />  
		       		    </f:facet>  
		                <h:outputText value="#{asset.assetName}" />
		            </p:column> 
		            
		            <p:column filterMatchMode="contains" filterBy="#{asset.model}"  >
		            	<f:facet name="header">  
		            		<h:outputText value="Model" />  
		       		    </f:facet>  
		                <h:outputText value="#{asset.model}" />
		            </p:column>
		            
		            <p:column filterMatchMode="contains" filterBy="#{asset.assetDescription}"  >
		            	<f:facet name="header">  
		            		<h:outputText value="Asset Description" />  
		       		    </f:facet>  
		                <h:outputText value="#{asset.assetDescription}" />
		            </p:column> 
		        		            
		            <p:column filterMatchMode="contains" filterBy="#{asset.hardDisk}"  >
		            	<f:facet name="header">  
		            		<h:outputText value="Hard Disk" />  
		       		    </f:facet>  
		                <h:outputText value="#{asset.hardDisk}" />
		            </p:column>
		            
		            <p:column filterMatchMode="contains" filterBy="#{asset.os}">
		            	<f:facet name="header">  
		            		<h:outputText value="OS" />  
		       		    </f:facet>  
		                <h:outputText value="#{asset.os}" />
		            </p:column> 
		            
		            <p:column filterMatchMode="contains" filterBy="#{asset.memory}">
		            	<f:facet name="header">  
		            		<h:outputText value="Memory(GB)" />  
		       		    </f:facet>  
		                <h:outputText value="#{asset.memory}" />
		            </p:column>
		            
		            <p:column filterMatchMode="contains" filterBy="#{asset.location}"> 
		            	<f:facet name="header">  
		            		<h:outputText value="Location" />  
		       		    </f:facet> 
		                <h:outputText value="#{asset.location}" />
		            </p:column>	 
		               
	             </p:dataTable>
	             	<p:commandButton id="viewCommand" style="float:left;" update=":assetForm:displaySingle :assetForm:displayDescription" value="View" icon="ui-icon-search"  oncomplete="assetDialog.show()"/> 
	             </p:scrollPanel>	              
	            </h:panelGrid>
	    
          </p:panel>   
           <p:dialog id="dialog" header="Asset Details" widgetVar="assetDialog" resizable="false"  
                          showEffect="fade" hideEffect="explode" >  
  				<p:scrollPanel style="width:700px; height:400px; padding: 0; margin: 0; " mode="native">  
	        	<h:panelGrid id="displaySingle" columns="6" cellspacing="8" columnClasses="employeeDetailLabel,gridCellMiddleLeftAligned, employeeDetailText, employeeDetailLabel,gridCellMiddleLeftAligned, employeeDetailText">  	  
	            
			           <h:outputLabel value="Asset Category" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.assetCategory}" />			                   
			          
			           <h:outputLabel value="Asset Type" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.assetType}" />	
			           
			           <h:outputLabel value="Asset Code" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.assetCode}" />
			           
			           <h:outputLabel value="Location" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.location}" />
			        
			           <h:outputLabel value="Asset Name" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.assetName}" />
			      
			           <h:outputLabel value="Model" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.model}" />   
			           
			           <h:outputLabel value="Memory (GB)" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.memory}" />	
			          	
			           <h:outputLabel value="OS" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.os}" />
			           
			           <h:outputLabel value="Manufacturer" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.manufacturer}" />
			           
			           <h:outputLabel value="Processor" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.processor}" />
		
			           <h:outputLabel value="Vendor Name" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.vendorName}" />
	
			           <h:outputLabel value="Hard Disk" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.hardDisk}" />
			
			           <h:outputLabel value="Serial Number" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.serialNumber}" />
	
			           <h:outputLabel value="Bar Code" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.barCode}" />
			           
	     	           <h:outputLabel value="Network Adaptor" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.networkAdaptor}" />
			           
			           <h:outputLabel value="Acquisition Date" />
			           <h:outputLabel value=":" />
			           <h:outputText value="#{assetAssignedBySysAdminBean.selectedAsset.acquisitionDate}" >
			           		<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{assetAssignedBySysAdminBean.timeZone}"/>
			           </h:outputText>

			           <h:outputLabel value="Expiry date" />
			           <h:outputLabel value=":" />
			           <h:outputText value="#{assetAssignedBySysAdminBean.selectedAsset.expiryDate}" >
			           		<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{assetAssignedBySysAdminBean.timeZone}"/>
			           </h:outputText>			           

			           <h:outputLabel value="Warranty Date " />
			           <h:outputLabel value=":" />
			           <h:outputText value="#{assetAssignedBySysAdminBean.selectedAsset.warrantyExpiryDate}">
			           		<f:convertDateTime pattern="dd-MMM-yyyy" timeZone="#{assetAssignedBySysAdminBean.timeZone}"/>
			           </h:outputText>

			           <h:outputLabel value="Asset Status" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.assetStatus}" />
			         
			           <h:outputLabel value="Business Impact" />
			           <h:outputLabel value=":" />
			           <h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.buinessImpact}" />		
			           	          
	          </h:panelGrid>	
	            <h:panelGrid id="displayDescription">
	            	    <h:outputLabel value="Asset Description : " style="font-weight:bold;"/>
			          	<h:outputLabel value="#{assetAssignedBySysAdminBean.selectedAsset.assetDescription}" />
			          	
			          	<h:outputLabel value="* Remarks :" style="font-weight:bold;"/>
			          	<p:inputTextarea value="#{assetAssignedBySysAdminBean.assignedRemarks}" style="width:550px;"/>
			    </h:panelGrid>
			    </p:scrollPanel>
	          <h:panelGroup style="padding-top: 5px; width: 100%; border-top: 1px solid #d9d9d9" columnClasses="gridCellMiddleRightAligned">
					<p:commandButton id="submit1" value="Assign" update="displaySingle growl" actionListener="#{assetAssignedBySysAdminBean.validateAction}"/>			
					<p:commandButton id="closeButton" process="@this" value="Close" oncomplete="assetDialog.hide()"/>	
			  </h:panelGroup>	
	         
	    </p:dialog>      
         
        <p:confirmDialog widgetVar="confirmation" id="confirmation" severity="alert" message="Do you want to proceed?">
				<h:panelGroup style="text-align: right; float: right;">
					<p:commandButton value="Yes" action="#{assetAssignedBySysAdminBean.assetAssignmentAction}" update=":assetForm" oncomplete="confirmation.hide()"/>
					<p:commandButton id="decline" value="No" onclick="confirmation.hide()" type="button" update=":assetForm"/>
				</h:panelGroup>
		</p:confirmDialog>  
           <p:commandButton value="Back" onclick="history.back();"  />
           
     </h:form>
	</ui:define>
	
</ui:composition>
